version 14.0
log using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\africancabinets_africa.log", replace
set more off
#delimit ;

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      africancabinets_africa.do                       *;
*       Date:           September 9, 2016                               *;
*       Author:         Molly Ariotti and Sona Golder                   *;
*       Purpose:      	Replicate results for CPS African portfolio     *;
*                       allocation paper, using Africa data 1990-2014.  *;
* 	    Input File:     Africa.dta                                      *;
*       Output File:    africancabinets_africa.log                      *;
*       Data Output:    none                                            *;             
*       Previous file:  none                                            *;
*       Machine:        laptop                           				*;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Open and summarize dataset.                                     *;
*     ****************************************************************  *;

use "\Users\sgolder\Dropbox\Portfolio Allocation\replication\Africa.dta"; 

sum;

desc;

*     ****************************************************************  *;
*       Drop African cabinets where there is no formateur coded.        *;
*     ****************************************************************  *;

drop if cabinetcode == 5;
drop if cabinetcode == 23;



*     ****************************************************************  *;
*       Create variables for analysis in Table 3                        *;
*     ****************************************************************  *;

gen parliamentary = 0;
replace parliamentary = 1 if presidential == 0;
label var parliamentary "1 = parliamentary, 0 = presidential";

gen seatshare_parl= seatshare*parliamentary;
gen formateur_parl= formateur*parliamentary;

*     ****************************************************************  *;
*     ****************************************************************  *;
*       Produce results in Table 3                                      *;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Model 1 all african cases                                       *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, robust;

*     ****************************************************************  *;
*       Model 2 presidential                                            *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if parliamentary == 0 , robust;

*     ****************************************************************  *;
*       Model 3 parliamentary                                           *;
*     ****************************************************************  *; 

regress portfolioshare seatshare formateur if parliamentary == 1, robust;


*     ****************************************************************  *; 
*       Replication of main text complete                               *;
*     ****************************************************************  *; 


*     ****************************************************************  *; 
*       Robustness check with clustering - results robust although      *;
*       the significance of the coefficient on formateur in Model 3     *;
*       decreases and is only significant at the 0.08 level.            *;
*     ****************************************************************  *; 

regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, cluster(cabinetcode);
regress portfolioshare seatshare formateur if parliamentary == 0, cluster(cabinetcode);
regress portfolioshare seatshare formateur if parliamentary == 1, cluster(cabinetcode);

*     ****************************************************************  *; 
*       Repeat with bootstrap clustering - results robust.              *;
*     ****************************************************************  *; 

regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, vce(boot, cluster(cabinetcode) reps(400) seed(10101));
regress portfolioshare seatshare formateur if parliamentary == 0, vce(boot, cluster(cabinetcode) reps(400) seed(10101));
regress portfolioshare seatshare formateur if parliamentary == 1, vce(boot, cluster(cabinetcode) reps(400) seed(10101));

*     ****************************************************************  *;
*       Jacknife procedures (drop one government)                       *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, vce(jackknife, cluster(cabinetcode));
regress portfolioshare seatshare formateur if parliamentary == 0, vce(jackknife, cluster(cabinetcode));
regress portfolioshare seatshare formateur if parliamentary == 1, vce(jackknife, cluster(cabinetcode));


log close;
exit;
